<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
        content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0">
    <title>&nbsp;</title>
    <link rel="stylesheet" type="text/css"
       media="screen and (min-width: 769px)" href="/css/layout.css" />

    <script src="/js/vue.min.js"></script>
    <script src="/js/httpVueLoader.js"></script><!-- 引入 http-vue-loader -->   
    <script src="/js/axios.min.js"></script>
    
</head>

<body>
<div id="app">
    <!-- 
    <div class="topbar" style="height: 1px;">
        <div class="center toptool">
            <strong>welcome</strong>
            <div class="links">
                <a href="">11</a>
                <a href="">22</a>
            </div>
        </div>
    </div>
     -->
    

    
    <!-- <div id="banner">
        <div class="swiper-container swiper-container-banner">
            <div class="swiper-wrapper">
                <div class="swiper-slide">
                    <a href="">
                        <img src="./imgs/banner.jpg" alt="" style="width: 100%;height: 222px;">
                    </a>
                </div>
            </div>
        </div>
    </div> -->

    



    <section class="container">
        <div class="right">
                
                <div class="smbox">
                    <div class="list_images">
                         <form action="" name="form1" method="post">
	                                  <table width="100%"  border="0" cellpadding="8" cellspacing="1" bgcolor="#CBD8AC">
                                        <tr bgcolor="#FFFFFF" style="height: 43px;">
                                            <td width="88" bgcolor="#FFFFFF" align="right">
                                                                                                                                                             姓名：
                                            </td>
                                            <td bgcolor="#FFFFFF" align="left">
                                                <input type="text" v-model="shenqing.xingming" style="width: 188px;" value="dfdf"/>
                                            </td>
                                        </tr>
                                        <tr bgcolor="#FFFFFF" style="height: 43px;">
                                            <td width="88" bgcolor="#FFFFFF" align="right">
                                                                                                                                               地址：
                                            </td>
                                            <td bgcolor="#FFFFFF" align="left">
                                                <input type="text" v-model="shenqing.dizhi" style="width: 288px;"/>
                                            </td>
                                        </tr>
                                        <tr bgcolor="#FFFFFF" style="height: 43px;">
                                            <td width="88" bgcolor="#FFFFFF" align="right">
                                                                                                                                                           电话：
                                            </td>
                                            <td bgcolor="#FFFFFF" align="left">
                                                <input type="text" v-model="shenqing.dianhua" style="width: 288px;"/>
                                            </td>
                                        </tr>
                                        <tr bgcolor="#FFFFFF" style="height: 43px;">
                                            <td width="88" bgcolor="#FFFFFF" align="right">
                                                                                                                                                          自我介绍：
                                            </td>
                                            <td bgcolor="#FFFFFF" align="left">
                                                <textarea name="ziwo" v-model="shenqing.ziwo" cols="3" cols="40"></textarea>
                                            </td>
                                        </tr>
                                        <tr bgcolor="#FFFFFF" style="height: 43px;">
                                            <td width="88" bgcolor="#FFFFFF" align="right">
                                                                                                                                                                申请时间：
                                            </td>
                                            <td bgcolor="#FFFFFF" align="left">
                                                <input type="text" v-model="shenqing.shenqingshi" style="width: 188px;" readonly/>
                                            </td>
                                        </tr>
                                        <tr bgcolor="#FFFFFF" height="30">
                                            <td width="88" bgcolor="#FFFFFF" align="right">
                                                &nbsp;
                                            </td>
                                            <td bgcolor="#FFFFFF" align="left">
                                            &nbsp;<input type="button" value="提交" @click="shenqingAdd()" style="width: 70px;"/>&nbsp; 
                                            </td>
                                        </tr>
                                     </table>   
                                  </form> 
                    </div>
                </div>
                
        </div>
    </section>

    
    
</div>


<script>

    function getUrlParam(name) 
    {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
        var r = window.location.search.substr(1).match(reg);  //匹配目标参数
        if (r != null) return unescape(r[2]); return null; //返回参数值
    }



    new Vue({
        el: '#app',
        data: 
		{
			shenqing:{
                  id:0,
                  user_id:0,
                  dongwu_id: getUrlParam('dongwu_id'),
                  xingming:"",

                  dizhi:"",
                  dianhua:"",
                  ziwo:"喜欢动物",
                  shenqingshi:"",

                  huifu:"",
            },
            
        },
        
        methods: 
		{
            
			shenqingAdd()
			{
                if(this.shenqing.xingming=="")
				{
					alert("请输入您的姓名");
					return;
				}
				if(this.shenqing.dianhua=="")
				{
					alert("请输入电话");
					return;
                }
                
				
				axios({
						method: 'POST',
						url: '/shenqingAdd',
						data: this.shenqing,
						params:{
							//code:123,
							//dode:456
						}
						}).then(data => {
							//console.log(data);
							//alert(data.data.state);
							if (data.data.state == 66)
							{
                                alert("申请成功");
                                var index = parent.layer.getFrameIndex(window.name);
				                parent.layer.close(index);
							} 
						    
						}).catch(error => {
							//console.log(error);
							alert(error);
                        }) 
                        
                         /* var index = parent.layer.getFrameIndex(window.name);
				         parent.layer.close(index);//关闭当前页 */
            },


            /* 获取系统时间 */
			padLeftZero (str)
			{
			return ('00' + str).substr(str.length);
			},

			formateDate(date, fmt)
			{
			if (/(y+)/.test(fmt)) {
			fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
			}
			let o = {
			'M+': date.getMonth() + 1,
			'd+': date.getDate(),
			'h+': date.getHours(),
			'm+': date.getMinutes(),
			's+': date.getSeconds()
			}
			for (let k in o) {
			if (new RegExp(`(${k})`).test(fmt)) {
			let str = o[k] + '';
			fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : this.padLeftZero(str));
			}
			}
			return fmt;
			},
			/* 获取系统时间 */
            



        },
        
        created()
		{
            this.shenqing.shenqingshi=this.formateDate(new Date(), 'yyyy-MM-dd hh:mm');
			var userJsonString = localStorage.getItem("user");
            if(userJsonString !=null)//判断是否登录
            {
                var user=JSON.parse(userJsonString);
                this.shenqing.user_id=user.uid;
            }

            this.getData();
		},

        components: {
            
        }
    })
</script>
</body>

</html>